package com.report;

import org.jxls.expression.ExpressionEvaluator;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;

import java.util.Map;

public class SpringExpressionEvaluator implements ExpressionEvaluator {

    private final ExpressionParser parser = new SpelExpressionParser();

    @Override
    public Object evaluate(String expression, Map<String, Object> context) {
        StandardEvaluationContext st = Tools.createSpelContext(context);
        return parser.parseExpression(expression).getValue(st);
    }

    @Override
    public Object evaluate(Map<String, Object> context) {
        return null;
    }

    @Override
    public String getExpression() {
        return "";
    }

}